<template>
    <div class="loginMain">
        <img src="../../assets/bgImg.png" alt="" class="bgImg">
        <div class="loginBox">
            <span class="loginTit">广告牌后台管理</span>
            <div class="userInfo">账号 <input type="text" v-model="userName">
            </div>
            <div class="userInfo userInfo1 ">密码 <input :type="passFlag ? 'password' : 'text'" v-model="userPass">
                <i class="el-icon-view" @click="passFlag = !passFlag"></i>
            </div>
            <div class="loginBtn" @click="loginHandle">登录</div>
        </div>
    </div>
</template>

<script>
import { LogIn } from '../../network/logIn'

export default {
    data() {
        return {
            userName: '',
            userPass: '',
            passFlag: true
        }

    },
    methods: {
        loginHandle() {
            console.log(this.userName);
            console.log(this.userPass);

            window.sessionStorage.setItem('activePath', '/Auditing')
            this.$router.replace('/Auditing')

            return
            LogIn({
                username: this.userName,
                password: this.userPass
            }).then(res => {
                console.log(res.data.msg);
                console.log(res.data.shop);
                if (res.data.msg !== undefined) {
                    this.$message.warning(res.data.msg)
                    return;
                }
                sessionStorage.shopMoney = res.data.shop.shopMoney
                sessionStorage.shopAccount = res.data.shop.username
                sessionStorage.userName = res.data.shop.shopName
                sessionStorage.shopId = res.data.shop.shopId
                if (sessionStorage.shopId == 1) {
                    window.sessionStorage.setItem('activePath', '/list')
                    this.$router.replace('/list')
                } else {
                    window.sessionStorage.setItem('activePath', '/userList')
                    this.$router.replace('/userList')
                }
            })
        }
    }
}
</script>
<style lang="less" scoped>
.bgImg {
    position: absolute;
    top: 280px;
    left: 400px;
    width: 355px;
    height: 346px;
}

.loginMain {
    position: relative;
    width: 100%;
    height: 100vh;
    background: url(../../assets/lob.png);
    background-size: 100% 100%;
}

.loginBox {
    position: absolute;
    top: 240px;
    left: 1076px;
    width: 350px;
    height: 400px;
    background: #FFFFFF;
    border-radius: 10px;

    .loginTit {
        position: absolute;
        top: 46px;
        left: 97px;
        font-size: 26px;
        font-family: Source Han Sans CN;
        font-weight: 400;
        color: #333333;
    }

    .userInfo {
        position: absolute;
        top: 146px;
        left: 36px;
        font-size: 24px;
        font-family: Source Han Sans CN;
        font-weight: 400;
        color: #333333;

        i {
            position: absolute;
            top: 6px;
            right: 10px;
        }

        input {
            margin-left: 10px;
            box-sizing: border-box;
            padding-left: 20px;
            width: 216px;
            height: 36px;
            border: 1px solid #348AFF;
            border-radius: 5px;
            outline: none;
            font-size: 24px;
        }

        span {
            position: absolute;
            bottom: -24px;
            left: 88px;
            font-size: 16px;
            font-family: Source Han Sans CN;
            font-weight: 400;
            color: #FB4646;
        }
    }

    .userInfo1 {
        top: 240px;
    }

    .loginBtn {
        position: absolute;
        bottom: 30px;
        left: 35px;
        width: 280px;
        height: 50px;
        background: #348AFF;
        border-radius: 5px;
        font-size: 24px;
        font-family: Source Han Sans CN;
        font-weight: 400;
        color: #FFFFFF;
        line-height: 50px;
        text-align: center;
        cursor: pointer;
    }
}
</style>
